<%--
  Created by IntelliJ IDEA.
  User: dqf
  Date: 2014/12/9
  Time: 18:33
  To change this template use File | Settings | File Templates.
--%>
<%@ page language="java" pageEncoding="UTF-8"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<%
  String path = request.getContextPath();
  String basePath = request.getScheme() + "://"
          + request.getServerName() + ":" + request.getServerPort()
          + path + "/";
%>
<div class="row">
  <!-- NEW WIDGET START -->
  <article class="col-sm-12 col-md-12 col-lg-12">
    <div class="jarviswidget well" id="wid-id-3"
         data-widget-colorbutton="false"
         data-widget-editbutton="false"
         data-widget-togglebutton="false"
         data-widget-deletebutton="false"
         data-widget-fullscreenbutton="false"
         data-widget-custombutton="false"
         data-widget-sortable="false">
      <!-- widget div-->
      <div>
        <div class="widget-body">
          <a class="btn btn-default" id="btn-re-common" href="javascript:void(0);"><i class="fa fa-lg fa-mail-reply-all"></i>返回</a>
          <s:if test="bidstart==null || isCreated(bidstart.id)">
            <a class="btn btn-default pull-right pull-right-fix" id="btn-confirm-common" href="javascript:void(0);"><i class="fa fa-rocket"></i> 提交</a>
          </s:if>
          <s:if test="isBacked(bidstart.id)">
            <a class="btn btn-default pull-right pull-right-fix" id="btn-recommit-common" href="javascript:void(0);"><i class="fa fa-rocket"></i> 再提交</a>
          </s:if>
          <s:if test="isApprove(1,bidstart.id)">
            <a class="btn btn-default pull-right pull-right-fix" id="btn-approve-common-1" href="javascript:void(0);"><i class="fa fa-fast-forward"></i> 审批通过</a>
          </s:if>
          <s:if test="isApprove(1,bidstart.id)">
            <a class="btn btn-default pull-right pull-right-fix" id="btn-reject-common-1" href="javascript:void(0);"><i class="fa fa-fast-backward"></i> 退回</a>
          </s:if>
          <s:if test="isApprove(2,bidstart.id)">
            <a class="btn btn-default pull-right pull-right-fix" id="btn-approve-common-2" href="javascript:void(0);"><i class="fa fa-fast-forward"></i> 审批通过</a>
          </s:if>
          <s:if test="isApprove(2,bidstart.id)">
            <a class="btn btn-default pull-right pull-right-fix" id="btn-reject-common-2" href="javascript:void(0);"><i class="fa fa-fast-backward"></i> 退回</a>
          </s:if>
          <s:if test="isApprove(3,bidstart.id)">
            <a class="btn btn-default pull-right pull-right-fix" id="btn-approve-common-3" href="javascript:void(0);"><i class="fa fa-fast-forward"></i> 审批通过</a>
          </s:if>
          <s:if test="isApprove(3,bidstart.id)">
            <a class="btn btn-default pull-right pull-right-fix" id="btn-reject-common-3" href="javascript:void(0);"><i class="fa fa-fast-backward"></i> 退回</a>
          </s:if>
          <a title="编辑" key="ajax_edit"  class="btn btn-default pull-right pull-right-fix <s:property value="isEdit(bidstart.id)"/>" href="javascript:void(0);">
            <i class="fa fa-pencil-square-o"></i>编辑
          </a>
          <hr class="simple">
          <form id="bidstart" class="smart-form" novalidate="novalidate" action="" method="post">
            <input type="hidden" name="keyId" id="keyId" value="<s:property value="bidstart.id" />"/>
            <input type="hidden" name="curDutyId" id="curDutyId" value="<s:property value="curDutyId" />"/>
            <header id="title" style="display: block;">
              招标立项表
              <a href="javascript:void(0);" key="btn-comment">
                                    <span class="txt-color-blueDark pull-right">
                                        <i class="fa-fw fa fa-comment-o"></i> 审批意见<span></span>
                                    </span>
              </a>
            </header>
            <fieldset>
              <div class="row">
                <label class="label col col-2">
                  <i class="fa fa-asterisk txt-color-red"></i>
                  项目名称
                </label>
                <section class="col col-5">
                  <label class="input state-disabled" >
                    <input type="hidden" name="projectid" id="projectid" value="<s:property value="bidstart.project.id"/>">
                    <input type="text" name="name" id="name" placeholder="请输入项目名称" disabled="disabled" value="<s:property value="bidstart.project.name"/>">
                  </label>
                </section>
              </div>
              <div class="row">
                <label class="label col col-2">
                  <i class="fa fa-asterisk txt-color-red"></i>
                  招标类型
                </label>
                <section class="col col-5">
                  <div class="inline-group" >
                    <label class="radio state-disabled" >
                      <input type="radio" name="type" value="0" <s:property value="bidstart.type==0?'checked':''" /> disabled="disabled">
                      <i></i>勘察招标
                    </label>
                    <label class="radio state-disabled" >
                      <input type="radio" name="type" value="1" <s:property value="bidstart.type==1?'checked':''"/> disabled="disabled">
                      <i></i>设计招标
                    </label>
                  </div>
                </section>
              </div>
              <div class="row">
                <label class="label col col-2">
                  <i class="fa fa-asterisk txt-color-red"></i>
                  招标方式
                </label>
                <section class="col col-5">
                  <div class="inline-group" >
                    <label class="radio state-disabled" >
                      <input type="radio" name="method" value="0" <s:property value="bidstart.method==0?'checked':''"/> disabled="disabled">
                      <i></i>公开招标
                    </label>
                    <label class="radio state-disabled" >
                      <input type="radio" name="method" value="1" <s:property value="bidstart.method==1?'checked':''"/> disabled="disabled">
                      <i></i>比选
                    </label>
                    <label class="radio state-disabled" >
                      <input type="radio" name="method" value="2" <s:property value="bidstart.method==2?'checked':''"/> disabled="disabled">
                      <i></i>邀标
                    </label>
                    <label class="radio state-disabled" >
                      <input type="radio" name="method" value="3" <s:property value="bidstart.method==3?'checked':''"/> disabled="disabled">
                      <i></i>抽签
                    </label>
                  </div>
                </section>
              </div>
              <div class="row">
                <label class="label col col-2">招标方式原因说明</label>
                <section class="col col-5">
                  <label class="input state-disabled">
                    <input name="reason" id="reason" disabled="disabled" placeholder="请输入招标方式原因说明"
                           type="text" value="<s:property value="bidstart.reason"/>">
                  </label>
                </section>
              </div>
              <div class="row">
                <label class="label col col-2">
                  <i class="fa fa-asterisk txt-color-red"></i>
                  是否委托招标代理机构
                </label>
                <section class="col col-5">
                  <div class="inline-group" >
                    <label class="radio state-disabled" >
                      <input type="radio" name="isDelegate" value="1" <s:property value="bidstart.isDelegate==1?'checked':''"/> disabled="disabled">
                      <i></i>是
                    </label>
                    <label class="radio state-disabled" >
                      <input type="radio" name="isDelegate" value="0" <s:property value="bidstart.isDelegate==0?'checked':''"/> disabled="disabled"><i></i>否
                    </label>
                  </div>
                </section>
              </div>
              <s:if test="bidstart.isDelegate==1">
                <div class="row">
                  <label class="label col col-2">招标代理机构名称</label>
                  <section class="col col-5">
                    <label class="input state-disabled">
                      <input name="agentName" id="agentName" disabled="disabled" placeholder="请输入招标代理机构名称"
                             type="text" value="<s:property value="bidstart.agentName"/>" disabled="disabled">
                    </label>
                  </section>
                </div>
              </s:if>
              <div class="row">
                <label class="label col col-2">拟启动招标时间</label>
                <section class="col col-2">
                  <label class="input state-disabled">
                    <i class="icon-append fa fa-calendar"></i>
                    <input  class="hasDatepicker" name="start" id="start" placeholder="请选择拟启动招标时间"
                            type="text" value="<s:date name="bidstart.start" format="yyyy-MM-dd"/>" disabled="disabled">
                  </label>
                </section>
              </div>

              <div class="row">
                <label class="label col col-2">招标大致内容</label>
                <section class="col col-5">
                  <label class="input state-disabled">
                    <input name="content" id="content" placeholder="请输入招标大致内容"
                           type="text" value="<s:property value="bidstart.content"/>" disabled="disabled">
                  </label>
                </section>
              </div>
              <div class="row">
                <label class="label col col-2">
                  <i class="fa fa-asterisk txt-color-red"></i>
                  拟招标限额（拦标价）
                </label>
                <section class="col col-4">
                  <label class="input state-disabled">
                    <input name="limitMoney" id="limitMoney" placeholder="请输入拟招标限额"
                           value="<s:property value="formatMoney(bidstart.limitMoney)"/>" disabled="disabled">
                  </label>
                </section>
                <label class="label col money-unit-form">万元</label>
              </div>
              <div class="row">
                <label class="label col col-2">
                  <i class="fa fa-asterisk txt-color-red"></i>
                  招标文件上传
                </label>
                <section class="col col-5">
                  <label class="input state-disabled">
                    <input  name="uploadify" id="filename" placeholder="" style="display: none" value="<s:property value="bidstart.fileBidId"/>">
                    </label>
                  </section>
              </div>
              <div class="row">
                <label class="label col col-2">招标公告</label>
                <section class="col col-5">
                  <label class="input state-disabled">
                    <input name="announce" id="announce" placeholder="请输入招标公告"
                           type="text" value="<s:property value="bidstart.announce"/>" disabled="disabled">
                  </label>
                </section>
              </div>
              <div class="row">
                <label class="label col col-2">相关网站链接</label>
                <section class="col col-5">
                  <label class="input state-disabled">
                    <input name="website" id="website" placeholder="请输入相关网站链接"
                           type="text" value="<s:property value="bidstart.website"/>" disabled="disabled">
                  </label>
                </section>
              </div>
              <div class="row">
                <label class="label col col-2">备注</label>
                <section class="col col-5">
                  <label class="input state-disabled">
                    <input name="mark" id="mark" placeholder="请输入备注"
                           type="text" value="<s:property value="bidstart.mark"/>" disabled="disabled">
                  </label>
                </section>
              </div>
              <div class="row">
                <label class="label col col-2">提交人</label>
                <section class="col col-2">
                  <label class="input state-disabled">
                    <input value="<s:property value="procreater.getName()"></s:property>" placeholder="" type="text" disabled="disabled">
                  </label>
                </section>
                <label class="label col col-1">提交日期</label>
                <section class="col col-2">
                  <label class="input state-disabled">
                    <input value="<s:date name="bidstart.getCreateDate()" format="yyyy-MM-dd"></s:date>" placeholder="" type="text" disabled="disabled">
                  </label>
                </section>
              </div>
            </fieldset>
          </form>
        </div>
      </div>
    </div>
  </article>
</div>

<script>
  //上传文件
  readLoad({
    objId:"filename",
    entityName:"fileBidId",
    sourceId:"filename"
  });

  //返回视图
  $("#btn-re-common").click(function(){
    loadURL("ajax!bidstart.action",$('#content'));
  });
  $("a[key=ajax_edit]").click(function(){
    loadURL("ajax-bidstart!input.action?keyId="+$("input#keyId").val(),$('#content'));
  });

</script>
<script type="text/javascript">
  $(function(){multiDuty()});
  //左侧意见栏
  $("a[key=btn-comment]").unbind("click").bind("click",function(){
    var keyId = $("input#keyId").val();
    var actionUrl = "ajax-running!comment.action?bussinessId="+keyId;
    var opt={title:"查看评论",type:"comment"};
    load_left_view($(this).attr("id"),actionUrl,opt);
    $("textarea[name='comment']").val("");
  })
  //第一步审批
  $("#btn-approve-common-1").click(
          function(e) {
            $.SmartMessageBox({
              title : "提示：",
              content : "确定提交申请吗？",
              buttons : '[取消][确认]'
            }, function(ButtonPressed) {
              if (ButtonPressed === "取消") {
                e.preventDefault();
                e.stopPropagation();
                return;
              }
              if (ButtonPressed === "确认") {
                $("#btn-approve-common-1").attr("disabled", "disabled");
                form_save("bidstart","<%=path%>/com/ajax-bidstart!approve1.action");
                loadURL("ajax!bidstart.action",$('#content'));
              }
            });
          }
  );
  //第二步审批
  $("#btn-approve-common-2").click(
          function(e) {
            $.SmartMessageBox({
              title : "提示：",
              content : "确定提交申请吗？",
              buttons : '[取消][确认]'
            }, function(ButtonPressed) {
              if (ButtonPressed === "取消") {
                e.preventDefault();
                e.stopPropagation();
                return;
              }
              if (ButtonPressed === "确认") {
                $("#btn-approve-common-2").attr("disabled", "disabled");
                form_save("bidstart","<%=path%>/com/ajax-bidstart!approve2.action");
                loadURL("ajax!bidstart.action",$('#content'));
              }
            });
          }
  );
  //第三步审批
  $("#btn-approve-common-3").click(
          function(e) {
            $.SmartMessageBox({
              title : "提示：",
              content : "确定提交申请吗？",
              buttons : '[取消][确认]'
            }, function(ButtonPressed) {
              if (ButtonPressed === "取消") {
                e.preventDefault();
                e.stopPropagation();
                return;
              }
              if (ButtonPressed === "确认") {
                $("#btn-approve-common-3").attr("disabled", "disabled");
                form_save("bidstart","<%=path%>/com/ajax-bidstart!approve3.action");
                loadURL("ajax!bidstart.action",$('#content'));
              }
            });
          }
  );

  //提交
  $("#btn-confirm-common").click(
          function(e) {
            var $valid = $("#bidstart").valid();
            if(!$valid){
              e.preventDefault();
              e.stopPropagation();
              return;
            }
            $.SmartMessageBox({
              title : "提示：",
              content : "确定提交申请吗？",
              buttons : '[取消][确认]'
            }, function(ButtonPressed) {
              if (ButtonPressed === "取消") {
                e.preventDefault();
                e.stopPropagation();
                return;
              }
              if (ButtonPressed === "确认") {
                var $validForm = $("#bidstart").valid();
                if(!$validForm) return false;
                $("#btn-confirm-common").attr("disabled", "disabled");
                form_save("bidstart","<%=path%>/com/ajax-bidstart!commit.action");
                loadURL("ajax!bidstart.action",$('#content'));
              }
            });
          }
  );

  $("#btn-reject-common-1").unbind().bind("click",function(e){
    $.SmartMessageBox({
      title : "提示：",
      content : "确定退回吗？",
      buttons : '[取消][确认]'
    }, function(ButtonPressed) {
      if (ButtonPressed === "取消") {
        e.preventDefault();
        e.stopPropagation();
        return;
      }
      if (ButtonPressed === "确认") {
        $("#btn-reject-common-1").attr("disabled", "disabled");
        var data={proDefKey:"usertask1",keyId:$("input#keyId").val(),numStatus:0}
        ajax_action("ajax-bidstart!reject.action",data);
        loadURL("ajax!bidstart.action",$('#content'));
      }
    });
  });

  $("#btn-reject-common-2").unbind().bind("click",function(e){
    $.SmartMessageBox({
      title : "提示：",
      content : "确定退回吗？",
      buttons : '[取消][确认]'
    }, function(ButtonPressed) {
      if (ButtonPressed === "取消") {
        e.preventDefault();
        e.stopPropagation();
        return;
      }
      if (ButtonPressed === "确认") {
        $("#btn-reject-common-2").attr("disabled", "disabled");
        var data={proDefKey:"usertask1",keyId:$("input#keyId").val(),numStatus:0}
        ajax_action("ajax-bidstart!reject.action",data);
        loadURL("ajax!bidstart.action",$('#content'));
      }
    });
  });
  $("#btn-reject-common-3").unbind().bind("click",function(e){
    $.SmartMessageBox({
      title : "提示：",
      content : "确定退回吗？",
      buttons : '[取消][确认]'
    }, function(ButtonPressed) {
      if (ButtonPressed === "取消") {
        e.preventDefault();
        e.stopPropagation();
        return;
      }
      if (ButtonPressed === "确认") {
        $("#btn-reject-common-3").attr("disabled", "disabled");
        var data={proDefKey:"usertask1",keyId:$("input#keyId").val(),numStatus:0}
        ajax_action("ajax-bidstart!reject.action",data);
        loadURL("ajax!bidstart.action",$('#content'));
      }
    });
  });

  //返回视图
  $("#btn-re-common").click(function(){
    loadURL("ajax!bidstart.action",$('#content'));
  });
</script>
